<?php 
require_once '../kelas/record.php';
require_once '../kelas/fungsi.php';
require_once '../kelas/amankanParam.php';
require_once '../kelas/rekening.php';
$dtPost = $objParamAman->postMethod();
$dtGet = $objParamAman->getMethod();
$objFungsi->inisialisasiProses($dtGet['on']);
switch ($dtGet['on']) {
	case 'simpan':
		$id =$dtPost['id'];
		unset($dtPost['id']);
		if(strlen($id)>0){
			$objRekening->update($dtPost,array('id' =>$id));
		}
		else{
			$objRekening->create($dtPost);
		}
		$ex  = $objRekening->execute();
		if($ex['success']==false){
			echo $objFungsi->alert($ex['error_msg']);
		};
		echo $objFungsi->redirect(BASEURLADMIN.'?v=master&p=rekening');
		break;
	case 'aktifasi':
		$objRekening->update(array('aktif'=>$dtPost['aktif']),array('id' => $dtPost['id'] ));
		echo json_encode($objRekening->execute());
		break;
	default:
		# code...
		break;
}